home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / wgt35.zip / WGTMENU.DOC < prev    next >
Text File  |  1993-01-28  |  4KB  |  131 lines

  1.                 WGT Menus
  2.               Copyright 1993 Chris Egerter
  3.  
  4. WGT Menus provides a quick and easy method of selecting options
  5. available to the end user. If you have a mouse, you can simply
  6. move to the item you want, and click the mouse button. If do
  7. not have a mouse, use the arrow keys to move around in the
  8. drop down menus.
  9.  
  10.  
  11. Creating a drop down menu:
  12.  
  13. First you need to define what the names of the drop down menus will be.
  14. This is done be entering them into an array at the beginning of your
  15. program:
  16.  
  17. char *menubar[10]={" QUIT  "," FILES "," Menu 1 "," Menu 2 ",NULL,NULL,NULL,NULL,NULL,NULL};
  18.  
  19. These names will appear on the 'menu bar' at the top of the screen.
  20. Notice how some are 'NULL'. These will not show anything on the menu bar.
  21. I suggest you put spaces on either side of the names, to keep the choices
  22. apart. When a user moves the mouse over these names (or presses F10 when
  23. there is no mouse installed), a sub-menu will appear.
  24.  
  25. To define the sub-menus, you must enter each choice as follows:
  26.  
  27. dropdown[0].choice[0]=" Help ";
  28. dropdown[0].choice[1]=" Quit ";
  29. dropdown[1].choice[0]=" Load ";
  30. dropdown[1].choice[1]=" Save ";
  31.      ^         ^
  32. Menu # --|         |--Choice #
  33.  
  34.  
  35. This would make sub-menus under the first and second drop-down choices.
  36. It would look like this:
  37.  
  38.    Quit    Files    Menu 1    Menu 2
  39.  | Help || Load |
  40.  | Quit || Save |
  41.  |------||------|
  42.  
  43. The format for sub-menus is:
  44. dropdown[n].choice[n]="Your choice"
  45.  
  46. with n ranging from 0 to 9.
  47.  
  48. This means you can have up to 10 drop down menus, with up to 10
  49. choices in each, for a total of 100 choices available to the user
  50. at a click of the mouse button!
  51.  
  52.  
  53. Available functions:
  54.  
  55. void initdropdowns();
  56.  
  57. Initializes drop-down menus and sub-menus.
  58. You must call this after you have defined the drop down menus and
  59. sub-menus.
  60. If you change the text in the menus, (such as toggling choices) you
  61. may need to call this again, to get the correct sizes for the sub-menus.
  62.  
  63. --------------------------------------------------------------------------
  64. void showmenubar();
  65.  
  66. Shows the drop-down menu bar at the top of the screen.
  67.  
  68. --------------------------------------------------------------------------
  69. int checkmenu();
  70.  
  71. Loops until the user selects a choice from the menu bar or clicks
  72. the mouse button outside of the menu bar.
  73. If a selection is made, it returns the number of the menu choice.
  74.  
  75. If you selected this choice, it would return the number 11.
  76. dropdown[1].choice[1]=" Save ";
  77.  
  78. result= menu*10   + choice
  79.       = 1*10      + 1
  80.       = 11
  81.  
  82. If the mouse is clicked outside the menu, it returns -1.
  83.  
  84. --------------------------------------------------------------------------
  85. void removemenubar();
  86.  
  87. Removes the menu bar from the screen.
  88.  
  89. --------------------------------------------------------------------------
  90.  
  91. Available variables:
  92.  
  93. Each drop down menu can have different colours.
  94. To set them, set the following variables:
  95.  
  96. dropdown[0].color=?
  97. dropdown[0].bordercolor=?
  98. dropdown[0].textcolor=?
  99.  
  100. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101.  
  102. The menu bar can have different colours as well by setting:
  103.  
  104. menubarcolor=254;
  105. menubartextcolor=1;
  106. bordercolor=255;
  107. highlightcolor=144;
  108.  
  109. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110. To see if the mouse is installed, check the variable:
  111.  
  112. int mouseinstalled;    =1 if installed, 0 if not installed
  113.  
  114. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  115. At default, the hotkey which brings the drop down menus from the keyboard
  116. is F10. You can change this key by changing the value in
  117.  
  118. char menuhotkey;
  119.  
  120. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121. With WGT Menus, you can create menus with any font you like.
  122. To change the font, load a new one in with wloadfont and set
  123.  
  124. wgtfont menufont;
  125.  
  126. eg. myfont=wloadfont("the_font.fnt");
  127.     menufont=myfont;
  128.  
  129. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. Please see the example files for a full demonstration.
  131.